package com.example.springdemo4;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/main2")
public class Main2 {

    @RequestMapping("/getCss")
    public String getCss() {
        return "/b.css";
    }

    @ResponseBody
    @RequestMapping("/getMap")
    public Map<String,Integer> getMap() {
        Map<String, Integer> map = new HashMap<>();
        map.put("张三", 10);
        map.put("李四", 11);
        map.put("王五", 12);
        return map;
    }

    @RequestMapping("setStatus")
    public String setStatus(HttpServletResponse response) {
        response.setStatus(404);
        return "/index.html";
    }

}
